<?php
namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class PageController extends HomeController {

	//系统单页
	public function index($id,$model='Page'){
		$data = D($model)->detail($id);
		if(!$data)
		{
			$data['category_id']=$id;
		}
		if ($data['status'] == '-1') {
			$this->error("该文档已被删除！");
		}elseif($data['status'] == '0'){
			$this->error("该文档已被禁用！");
		}

		/* 分类信息 */
		$category = $this->category($data['category_id']);
		$this->assign('category',$category);//topid
		
		$this->assign('data',$data);//数据
		$this->setSeo($data['title'],$data['keyword'],$data['description']);
		$this->display($category['template_index']?$category['template_index']:"about");
	}
	public function lists($id,$model="Page")
	{
		$this->index($id,$model);
	}
}